﻿/*
drop table mailsharp_message_queue
drop table mailsharp_recipient_queue
drop table mailsharp_message_archive
drop table mailsharp_recipient_archive
*/

create table mailsharp_message_queue
(
  id int identity(1,1) not null,
  from_name varchar(255) not null,
  from_email varchar(255) not null,
  sender varchar(255) null,
  reply_to varchar(255) null,
  subject varchar(255) not null,
  start_send_date_time datetime not null,
  html_body nvarchar(max) not null,
  plain_text_body nvarchar(max) not null,
  CONSTRAINT [PK_mailsharp_message_queue] PRIMARY KEY CLUSTERED 
  (
	  id ASC
  ) ON [PRIMARY]
) ON [PRIMARY]
GO

create table mailsharp_recipient_queue
(
  id int identity(1,1) not null,
  message_id int not null,
  to_name varchar(255) not null,
  to_email varchar(255) not null,
  merge_values varchar(max) null,
  CONSTRAINT [PK_mailsharp_recipient_queue] PRIMARY KEY CLUSTERED
  (
    id ASC 
  ) ON [PRIMARY] 
) ON [PRIMARY]
GO

create table mailsharp_message_archive
(
  id int not null,
  from_name varchar(255) not null,
  from_email varchar(255) not null,
  sender varchar(255) null,
  reply_to varchar(255) null,
  subject varchar(255) not null,
  html_body nvarchar(max) not null,
  plain_text_body nvarchar(max) not null,
  CONSTRAINT [PK_mailsharp_message_archive] PRIMARY KEY CLUSTERED 
  (
	  id ASC
  ) ON [PRIMARY]
) ON [PRIMARY]
GO

create table mailsharp_recipient_archive
(
  id int not null,
  message_id int not null,
  to_name varchar(255) not null,
  to_email varchar(255) not null,
  merge_values varchar(max) null,
  success bit default 0,
  send_date_time datetime not null,
  CONSTRAINT [PK_mailsharp_recipient_archive] PRIMARY KEY CLUSTERED
  (
    id ASC 
  ) ON [PRIMARY] 
) ON [PRIMARY]
GO